package com.core.services;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.core.model.User;
import com.core.repositories.UserRepository;

@Service
@Transactional
public class UserService {
	
	@Autowired
	UserRepository repository;
	
	public User saveUser(User user){
		return repository.save(user);
	}
	
	public void deleteUser(User user){
		repository.delete(user);
	}
	
	public User findUserById(Long id){
		return repository.findById(id);
	}
	
	public User updateUser(User newUser){
		return repository.save(newUser);
	}
}
